#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <stdlib.h>

/*int main()
{
	int* p = (int *)malloc(5 * sizeof(int));
	int i = 0;
	if (p != NULL)
	{
		for (i = 0; i < 5; i++)
		{
			printf("%d ", p[i] = i);
		}
	}
	int * ptr=(int *)realloc(p, 10 * sizeof(int));
	if (ptr != NULL)
	{
		p = ptr;
		ptr = NULL;
		for (i = 5; i < 10; i++)
		{
			printf("%d ", p[i] = i);
		}
	}
	free(p);
	p = NULL;
	return 0;
}*/
int main()
{
	int* p = (int*)calloc(10, sizeof(int));
	if (p == NULL)
	{
		perror("calloc");
		return 1;
	}
	else
	{
		int i = 0;
		for (i = 0; i < 10; i++)
		{
			printf("%d ", p[i]=i);
		}
		free(p);
		p = NULL;
	}
	return 0;
}